import axios from "axios";

const instance = axios.create({
    baseURL: '/api',
    // timeout: 1000,
    // headers: {'X-Custom-Header': 'foobar'}
});
instance.interceptors.request.use(function (config) {//请求
  //  console.log(config);
   if(config.url!='/adminUser/login'){// 除去登录接口，其他的都要带token
     config.headers.token=sessionStorage.getItem("token")
   }
    return config;
  }, function (error) {
    
    return Promise.reject(error);
  });


instance.interceptors.response.use(function (response) {//响应拦截
    return response.data;
  }, function (error) {
    return Promise.reject(error);
});
export default instance;